Copy object text string to attribute?

I need to copy a text string in the object text to an attribute.

The object text string is the RequisitePro ID that is part of the object text imported from the RequisitePro MS Word doucment. Objects that have this ID embedded in the object text are formatted as:
Doc1 Object text...
...
Doc9999 Object text ...

I need a DXL script to copy the only RequisitePro ID string Doc# from the object text if it exists to a text attribute, and another script that can strip the RequisitePro ID string from the object text.

I would think this would be a common practice for anyone that has to import a document that has these RequisitePro IDs, but I have not been successful in my search.

Any advice or help would be greatly appreciated.
KaiserSose - Mon Oct 10 09:42:08 EDT 2011

Re: Copy object text string to attribute?
KaiserSose - Mon Oct 10 09:53:02 EDT 2011

Also, the RequisitePro IDs are surrounded by brackets which was missed in my initial post as the message board treated it as a URL.

Re: Copy object text string to attribute?
llandale - Mon Oct 10 14:31:21 EDT 2011

Not too good with Regular Expressions but this may get you going:

string RegExpString = "^(\\[Doc[0-9]+\\])([" charOf(1) "-" charOf(255)"]*)"
Regexp reReqPro = regexp2(RegExpString)
 
void DoTest(string InString)
{  print InString "...\t"
   string ReqPart, TxtPart
   if (reReqPro InString) //
   then
   {  ReqPart = InString[match 1]
      TxtPart = InString[match 2]
      print "[" ReqPart "]\t^" TxtPart "^\n"
   }
   else print "no match\n"
}
 
DoTest("[Doc12]Test")
DoTest("[Doc1333332]Test")
DoTest("[Doc]Test")

 

  • Louie